package com.etheart.music.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.etheart.datamanagement.service.DatamanagementService;
import com.etheart.framework.core.dao.Page;
import com.etheart.framework.core.fulltextsearch.FullTextQueryParameter;
import com.etheart.framework.core.fulltextsearch.FullTextQueryService;
import com.etheart.model.entity.Song;

@Service("music_SongFullTextQueryService")
public class SongFullTextQueryServiceImp implements SongFullTextQueryService {
	
	@Autowired
	private FullTextQueryService fullTextQueryService;
	
	@Autowired
	private DatamanagementService datamanamgentService;

	@Transactional(readOnly=true)
	public Page<Song> fullTextQuerySongs(String keyword,int pageNo) {
		FullTextQueryParameter<Song> queryPrame = new FullTextQueryParameter<Song>(Song.class, keyword, "name","singer.singername","album.name","lrcContent");
		int pageSize =  datamanamgentService.getIntValue("pageSize");
		//高亮 需要配置注解
		queryPrame.setHighlight(true);
		return fullTextQueryService.find(queryPrame, pageNo,pageSize);
	}
}
